cmake_minimum_required(VERSION 2.8)

project(friendly_gl)

set(PROJECT_PATH ..)
set(TEST_PATH ${PROJECT_PATH}/test)
set(INCLUDE_PATH ${PROJECT_PATH}/include)
set(FRIENDLY_GL_PATH ${PROJECT_PATH}/friendly_gl)

if (WIN32)
  if (CMAKE_CL_64)
    set(WIN_BIT win64)
  else()
    set(WIN_BIT win32)
  endif()
endif()

if (WIN32)
  set(LIB_PATH ../../lib/${WIN_BIT})
  set(DLL_PATH ..\\${PROJECT_PATH}\\bin\\${WIN_BIT})
endif()

  # List of sources for testing project
set(SOURCE_EXE ${TEST_PATH}/test.cpp)

  # List of friendly_gl sources
set(SOURCE_FRIENDLY_GL ${FRIENDLY_GL_PATH}/FriendlyGL.cpp)

  # List of friendly_gl headers
set(INCLUDE_FRIENDLY_GL ${FRIENDLY_GL_PATH}/FriendlyGL.h)

include_directories(${INCLUDE_PATH}/ ${FRIENDLY_GL_PATH}/)

if (WIN32)
  add_custom_command(OUTPUT dll.txt COMMAND copy ${DLL_PATH} .\\Debug)
endif()

add_executable(friendly_gl ${SOURCE_EXE} ${SOURCE_FRIENDLY_GL} ${INCLUDE_FRIENDLY_GL} dll.txt) #${DLL})

if (WIN32)
  target_link_libraries(friendly_gl ${LIB_PATH}/*)
endif()
